var grmpIndex = {
    init: function () {
        var grmpIndexNCPDData = grmpIndex.getGrmpIndexNCPDData();
        var json = [{
            "id": "grmpIndexDiv",
            "number": 12,
            "type": 7,
            "body": {
                "type": "1"
            },
            "clsTop": "5px"
        }, {
            "id": "grmpIndexDiv2",
            "number": 2,
            "child": [{
                "id": "grmpIndexDiv21",
                "number": 12,
                "type": 8,
                "title": "名片公示栏",
                "body": {
                    "id": "grmpIndexDiv211",
                    "data": grmpIndexNCPDData
                },
                "height": "400px",
                "clsTop": "5px"
            }, {
                "id": "grmpIndexDiv22",
                "number": 12,
                "type": 9,
                "body": {},
                "height": "120px",
                "clsTop": "5px"
            }]
        }, {
            "id": "grmpIndexDiv3",
            "number": 7,
            "type": 10,
            "body": [
                { id: "grmpIndexDiv31", title: "账号标签" },
                // { id: "grmpIndexDiv32", title: "绑定员工信息" },
                // { id: "grmpIndexDiv33", title: "岗位/角色/公司" }
            ],
            "minHeight": "500px",
            "clsLeft": "5px",
            "clsTop": "5px"
        }, {
            "id": "grmpIndexDiv4",
            "number": 3,
            "type": 1,
            "body": `
                <div style="width: 100%;text-align: center;padding-top: 20px;">
                    <img src="static/images/product-6-148x193.jpg" style="padding: 10px;border: 1px solid #ddd;width: 60%;">
                </div>
                <div style="text-align: center;padding-top: 20px;font-size: 25px;font-weight: 900;">Trick Mirror</div>
                <div style="text-align: center;">Jia Tolentino</div>
            `,
            "minHeight": "500px",
            "clsLeft": "5px",
            "clsTop": "5px"
        }]
        var divHtml = kaHtml.init("grmpIndexDivHtml", json, 0, function () {
            var userPersonalTags = grmpIndex.getUserpersonaltags();
            var grmpIndexDiv31Html = ``;
            for (var i in userPersonalTags) {
                grmpIndexDiv31Html = grmpIndexDiv31Html + `<a class="` + userPersonalTags[i].b + ` ` + userPersonalTags[i].co + `" href="#">` + userPersonalTags[i].name + `</a>`;
            }
            grmpIndexDiv31Html = `<div class="tagcloud">` + grmpIndexDiv31Html + `</div>`;
            $("#grmpIndexDiv31_content").html(grmpIndexDiv31Html);
            // var grmpIndexDiv32Html = kaHtmlLoadContent.body.type11({
            //     num: 3,
            //     data: [{
            //         code: "code",
            //         name: "工号"
            //     }, {
            //         code: "name",
            //         name: "姓名"
            //     }, {
            //         code: "pension_no",
            //         name: "参养老保险号"
            //     },{
            //         code: "recruitment_channels",
            //         name: "招聘渠道"
            //     }, {
            //         code: "education",
            //         name: "学历"
            //     }, {
            //         code: "date_of_arrival",
            //         name: "入职日期"
            //     }, {
            //         code: "gender",
            //         name: "性别"
            //     }, {
            //         code: "stature",
            //         name: "身高"
            //     }, {
            //         code: "place_of_work",
            //         name: "工作地点"
            //     }, {
            //         code: "marriage",
            //         name: "婚否"
            //     }]
            // }, "grmpIndexDiv32_content_wwww");
            // $("#grmpIndexDiv32_content").html(grmpIndexDiv32Html);
            // var grmpIndexDiv33Html = `
            //     <fieldset class="layui-elem-field">
            //         <legend>岗位</legend>
            //         <div class="layui-field-box">
            //            <span class="layui-badge layui-bg-blue">蓝</span>
            //            <span class="layui-badge layui-bg-blue">蓝</span>
            //            <span class="layui-badge layui-bg-blue">蓝</span>
            //            <span class="layui-badge layui-bg-blue">蓝</span>
            //         </div>
            //     </fieldset>
            //     <fieldset class="layui-elem-field">
            //         <legend>角色</legend>
            //         <div class="layui-field-box">
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //         </div>
            //     </fieldset>
            //     <fieldset class="layui-elem-field">
            //         <legend>公司</legend>
            //         <div class="layui-field-box">
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //             <span class="layui-badge layui-bg-blue">蓝</span>
            //         </div>
            //     </fieldset>
            // `;
            // $("#grmpIndexDiv33_content").html(grmpIndexDiv33Html);
            tagcloud({
                selector: ".tagcloud",  //元素选择器
                fontsize: 13,       //基本字体大小, 单位px
                radius: 130,         //滚动半径, 单位px 页面宽度和高度的五分之一
                mspeed: "slow",   //滚动最大速度, 取值: slow, normal(默认), fast
                ispeed: "slow",   //滚动初速度, 取值: slow, normal(默认), fast
                direction: 135,     //初始滚动方向, 取值角度(顺时针360): 0对应top, 90对应left, 135对应right-bottom(默认)...
                keep: false          //鼠标移出组件后是否继续随鼠标滚动, 取值: false, true(默认) 对应 减速至初速度滚动, 随鼠标滚动
            });
        });
    },
    getGrmpIndexNCPDData: function () {
        var option = kaValue.getUrl("getNCPDData");
        var NCPDDatas = [];
        option.data = {
            newtype: 1
        };
        option.success = function (re) {
            if (re.code == 200) {
                NCPDDatas = re.data;
            } else {
                kaMsg.error(re);
            }
        }
        ka.ajax(option);
        return NCPDDatas;
    },
    getUserpersonaltags: function () {
        var option = kaValue.getUrl("getUserpersonaltags");
        var userPersonalTags = [];
        option.data = {
            type: 1
        };
        option.success = function (re) {
            if (re.code == 200) {
                userPersonalTags = re.data;
            } else {
                kaMsg.error(re);
            }
        }
        ka.ajax(option);
        return userPersonalTags;
    },
}